<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <!-- <div id="root">
        {{name}}
        <div class="header">
            <ul class="header_ul">
                <li v-for="(book,index) in content">
                    {{book.number}}
                    <ul v-for="sub in book.subdirectory"><li>{{sub}}</li></ul>
                </li>
            </ul>
        </div>
    </div> -->

    <div id="root" :class="isShow?'white':'black'">
        {{name}}
        <div class="header"  >
            <input type="button" value="切换背景" @click="changeisShow">
            <ul class="header_ul">
                <!-- <li v-for="(book,index) in content">
                    {{book.number}}
                    <ul v-for="sub in book.subdirectory"><li>{{sub}}</li></ul>
                </li> -->
                <li v-for="(book,index) in content">
                    {{book.name}}
                    <ul><li>
                        {{book.subdirectory[0]}}
                        {{book.subdirectory[1]}}
                    </li></ul>
                </li>
            </ul>
        </div>
    </div>

    <script>
    new Vue({
        el: '#root',
        data:{
            isShow:true
        },
        methods: {
            changeisShow(){
                this.isShow=!this.isShow;
                console.log('改变了isshow  '+this.isShow);
            }
        },
    })
    </script>
</body>
</html>